<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>成员管理</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/wallet.css" />
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">成员管理</h1>		    
		</header>
		<div class="mui-content fjysq_memcontent">
			<ul class="fjysq_memlis2">
				<!--<li class="clearfix">
					<div class="left">
							<div class="fjysq_memimg">
								<img src="../images/toux.jpg"></div>
							<div class="fjysq_meminfo">
								<p class="fjysq_memnam">徐洛奇工作室</p>
								<p class="fjysq_memdt">夏季优惠大酬宾</p>
							</div>
					</div>
					<div class="right"><button type="button" class="agree">移除</button></div>
				</li>-->
			</ul>
		</div>
		<script type="text/javascript" src="../js/jquery.min.js"></script>
		<script type="text/javascript">
			$('.fjysq_memlis > li').bind('click', function(){
			    $(this).addClass('active').siblings().removeClass('active');
			});
		</script>
	</body>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
<script type="text/javascript" src="../js/app.js"></script>
<script>
	$(function(){
		$.ajax({
			url: APP.api_url + 'wallet/sel_union_list',
			data: {
				token		: get_token(),
				uid			: getUid(),
			},
			success: function(data) {
				if(data.code == 200) {
					var union_item = data.data.union_item;
					var cut_agent_id = data.data.cut_agent_id;
					var union_item_htm=''
					for(var i=0;i<union_item.length;i++){
						var shenhe='';
						if(cut_agent_id != union_item[i].agent_id){
							if(union_item[i].apply == 1){
								shenhe = "<div class='right'><button onclick=shenhe("+union_item[i].id+",2) type='button' class='agree'>同意</button></div></li>";
							}else if(union_item[i].apply == 2){
								shenhe = "<div class='right'><button onclick=remove_member("+union_item[i].agent_id+") type='button' class='agree'>移除</button></div></li>";
							}
						}
						//图片地址
						var touxiang = user_tupian(union_item[i].thumb,'../images/toux.jpg');
						union_item_htm ="<li class='clearfix'><div class='left'>"+
										"<div class='fjysq_memimg'>"+
										"<img src='"+touxiang+"'></div>"+
										"<div class='fjysq_meminfo'>"+
										"<p class='fjysq_memnam'>"+union_item[i].store_name+"</p>"+
										"<p class='fjysq_memdt'>"+union_item[i].business_scope+"</p></div></div>"+shenhe;
						$('.fjysq_memlis2').append(union_item_htm);
					}
					
				}
			}
		});
	})
	//审核同意
	function shenhe(item_id,is_yes){
		$.ajax({
			url: APP.api_url + 'wallet/audit_ok',
			data: {
				token		: get_token(),
				uid			: getUid(),
				item_id		: item_id,
				is_yes		: is_yes
			},
			success: function(data) {
				layer.msg(data.msg, {
						  time: 2000 
						}, function(){
							location.reload();
						});
			}
		});
	}
	//移除联盟
	function remove_member(agent_id){
		$.ajax({
			url: APP.api_url + 'wallet/remove_member',
			data: {
				token		: get_token(),
				uid			: getUid(),
				agent_id	: agent_id
			},
			success: function(data) {
				layer.msg(data.msg, {
						  time: 2000 
						}, function(){
							location.reload();
						});
			}
		});
	}
</script>
